package edu.gmu.foxhound;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

public class Util {

	public static void CreateAlarm(Context context, long triggerTime){
		
		System.out.println("About to create alarm intent");
		
		//create Intent and PendingIntent to send to alarm
    	Intent intent = new Intent(context.getString(R.string.intent_action));
    	PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
    	
    	System.out.println("getting alarm service");
    	
    	//get time
    	
    	
    	//get alarm service and create alarm
    	AlarmManager alrmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    	alrmMgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, System.currentTimeMillis() + triggerTime, pendingIntent);
    	
    	System.out.println("Alarm created");
	}
	
}
